package team.archai.nexus.flow.dto;

import org.activiti.engine.repository.Model;

import java.util.Optional;

/**
 * 流程模型传输实体类
 *
 * @author lishibin
 * @version 2025-04-09
 * @since  1.8
 **/
public class ModelDTO {

    /**
     * 流程名称
     */
    private String name;
    private String key;
    private String category;
    private Integer version;
    private String description;
    private String bpmnXml;
    private String bpmnXmlBase64;
    private String id;
    private String thirdModelId;

    public Model fillModel(Model model) {
        model.setCategory(Optional.ofNullable(this.getCategory()).orElse(model.getCategory()));
        model.setKey(Optional.ofNullable(this.getKey()).orElse(model.getKey()));
        model.setName(Optional.ofNullable(this.getName()).orElse(model.getName()));
        model.setVersion(Optional.ofNullable(this.getVersion()).orElse(model.getVersion()));
        return model;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getBpmnXml() {
        return bpmnXml;
    }

    public void setBpmnXml(String bpmnXml) {
        this.bpmnXml = bpmnXml;
    }

    public String getBpmnXmlBase64() {
        return bpmnXmlBase64;
    }

    public void setBpmnXmlBase64(String bpmnXmlBase64) {
        this.bpmnXmlBase64 = bpmnXmlBase64;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getThirdModelId() {
        return thirdModelId;
    }

    public void setThirdModelId(String thirdModelId) {
        this.thirdModelId = thirdModelId;
    }

    @Override
    public String toString() {
        return "ModelDTO{" +
                "name='" + name + '\'' +
                ", key='" + key + '\'' +
                ", category='" + category + '\'' +
                ", version=" + version +
                ", description='" + description + '\'' +
                ", bpmnXml='" + bpmnXml + '\'' +
                ", bpmnXmlBase64='" + bpmnXmlBase64 + '\'' +
                ", id='" + id + '\'' +
                ", thirdModelId='" + thirdModelId + '\'' +
                '}';
    }
}
